package com.oocl.userinfo.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.oocl.userinfo.util.HTMLUtil;

public class ErrorServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	private final String ERROR_MSG_KEY = "errorMsg";

	@Override
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		PrintWriter writer = response.getWriter();
		String errorMsg = request.getAttribute(ERROR_MSG_KEY).toString();
		HTMLUtil.writeErrorMsgHTML(errorMsg, writer);
		writer.close();
	}

	@Override
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
